package com.koala.learn.excellearn.entity;

import com.alibaba.excel.converters.Converter;
import com.alibaba.excel.metadata.GlobalConfiguration;
import com.alibaba.excel.metadata.data.WriteCellData;
import com.alibaba.excel.metadata.property.ExcelContentProperty;

/**
 * @author yantingrui
 * @date 2022/3/30   16:13
 */
public class AgeConvert implements Converter<Integer> {
    @Override
    public WriteCellData<?> convertToExcelData(Integer value, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) throws Exception {
        if (value == null) {
            return new WriteCellData("----");
        } else if (value < 10) {
            return new WriteCellData("少年");
        } else if (value < 20) {
            return new WriteCellData("青少年");
        } else {
            return new WriteCellData("----");
        }
    }
}
